import { APPFN_SET_NAME_VALUE, APPFN_SET_VALUE_MAP } from '@@/utils'

// 11-草稿， 12-申请中，13-准备中，21-运行中，22-暂停，31-终止，32-完成，41-废弃，99-删除
export enum ProjectStatus {
  DRAFT = 11,
  APPLYING = 12,
  PREPARING = 13,
  BEGIN = 21,
  PAUSE = 22,
  STOP = 31,
  FINISH = 32,
  ABANDON = 41,
  DELETE = 99
}

export const PROJECT_STATUS_ARR = [
  {
    value: ProjectStatus.DRAFT,
    label: '草稿',
    icon: 'liebiaozhuangtai-caogao',
    color: 'default'
  },
  {
    value: ProjectStatus.APPLYING,
    label: '申请中',
    icon: 'liebiaozhuangtai-shenqingzhong',
    color: 'processing'
  },
  {
    value: ProjectStatus.PREPARING,
    label: '准备中',
    icon: 'liebiaozhuangtai-zhunbeizhong',
    color: 'processing'
  },
  {
    value: ProjectStatus.BEGIN,
    label: '运行中',
    icon: 'liebiaozhuangtai-jinhangzhong',
    color: 'warning'
  },
  {
    value: ProjectStatus.PAUSE,
    label: '暂停',
    icon: 'liebiaozhuangtai-yizanting',
    color: 'warning'
  },
  {
    value: ProjectStatus.STOP,
    label: '终止',
    icon: 'liebiaozhuangtai-yizhongzhi',
    color: 'default'
  },
  {
    value: ProjectStatus.FINISH,
    label: '已完成',
    icon: 'liebiaozhuangtai-yitongguo',
    color: 'success'
  },
  {
    value: ProjectStatus.ABANDON,
    label: '已废弃',
    icon: 'liebiaozhuangtai-yifeiqi',
    color: 'error'
  },
  {
    value: ProjectStatus.DELETE,
    label: '已删除',
    icon: 'liebiaozhuangtai-yishanchu',
    color: 'error'
  }
]

export const PROJECT_STATUS_NORMAL = [
  {
    value: ProjectStatus.PREPARING,
    label: '准备中',
    color: 'processing'
  },
  {
    value: ProjectStatus.BEGIN,
    label: '运行中',
    color: 'processing'
  },
  {
    value: ProjectStatus.PAUSE,
    label: '暂停',
    color: 'warning'
  },
  {
    value: ProjectStatus.STOP,
    label: '终止',
    color: 'default'
  },
  {
    value: ProjectStatus.FINISH,
    label: '已完成',
    color: 'success'
  },
  {
    value: ProjectStatus.ABANDON,
    label: '已废弃',
    color: 'default'
  }
]

export const PROJECT_STATUS_MAP = APPFN_SET_VALUE_MAP(PROJECT_STATUS_ARR)

export const ProjectClassification = {
  '1': '注册分类',
  '2': '注册分类',
  '3': '医疗技术分类',
  '4': '研究类型',
  '6': '注册分类'
}

export const getDrugRegisterTypeName = (type) => {
  if (type) {
    return ProjectClassification[type]
  }
  return '注册分类'
}

/**
 * 试验状态数组
 */
export const TRIAL_STATUS_ARR = [
  {
    value: 11,
    label: '草稿',
    name: 'DRAFT'
  },
  {
    value: 13,
    label: '准备中',
    name: 'PREPARING'
  },
  {
    value: 21,
    label: '运行中',
    name: 'BEGIN'
  },
  {
    value: 22,
    label: '暂停',
    name: 'PAUSE'
  },
  {
    value: 26,
    label: '还原中',
    name: 'RESTORE'
  },
  {
    value: 31,
    label: '终止',
    name: 'STOP'
  },
  {
    value: 32,
    label: '完成',
    name: 'FINISH'
  },
  {
    value: 40,
    label: '数据迁移中',
    name: 'MIGRATING'
  },
  {
    value: 99,
    label: '删除',
    name: 'DELETE'
  }
]

export const TRIAL_STATUS_ARR_NV = APPFN_SET_NAME_VALUE(TRIAL_STATUS_ARR)
